<template>
  <div>
    <div class="left" style="background-color: #fff;">
      <!-- <div class="radioDom ">
        <el-radio-group v-model="radio">
          <el-radio-button label="专利"></el-radio-button>
          <el-radio-button label="商标"></el-radio-button>
          <el-radio-button label="诉讼"></el-radio-button>
        </el-radio-group>
      </div> -->
    </div>

    <div v-if="radio == '专利'">
      <div v-if="seniortype">
        <div v-if="!seniorListType">
          <el-main class="left">
            <div class="boxWidth">
              <div class="title">
                <div>{{ seniortype ? "高级检索" : "普通检索" }}</div>
                <div>
                  <el-button style="
                    display: block;
                    background-color: #106bf3;
                    border-color: #33bf92;
                    border-radius: 10px;
                  " @click="SearchType" type="primary">切换至{{ seniorName }}</el-button>
                </div>
              </div>
              <el-row :gutter="12">
                <el-col :span="24" style="margin-bottom: 20px">
                  <el-col :xl="9" :lg="8">
                    <el-select @change="changs" v-model="leng[0].select" style="width: 100%" placeholder="主要字段">
                      <el-option v-for="item in data.fields" :key="item" :label="item" :value="item">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :xl="15" :lg="16">
                    <el-input @input="changInpnut(0)" v-model="leng[0].input" placeholder="可输入关键词，公司名称或者专利号"></el-input>
                  </el-col>
                </el-col>
                <el-col v-for="(len, index) in num" :key="index" :span="24" style="margin-bottom: 20px">
                  <el-col :xl="3" :lg="3">
                    <el-select @change="changs2" v-model="leng[index + 1].name" placeholder="AND">
                      <el-option v-for="item in data.exp" :key="item" :label="item" :value="item">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :xl="6" :lg="5">
                    <el-select @change="changs3" v-model="leng[index + 1].select" style="width: 100%"
                      placeholder="[全字段]申请(专利权)人">
                      <el-option v-for="item in data.fields" :key="item" :label="item" :value="item">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :xl="15" :lg="16">
                    <el-input @input="changInpnut2(index + 1)" v-model="leng[index + 1].input" placeholder="例如：华为OR中心">
                    </el-input>
                  </el-col>
                </el-col>
                <el-col :span="24" style="margin-bottom: 20px">
                  <el-col :xl="6" :lg="6">
                    <el-button v-if="num < 9" @click="addNum"
                      style="width: 100%; background-color: #f2f3f5">+添加字段</el-button>
                  </el-col>
                </el-col>
                <el-col :span="24" style="margin-bottom: 20px">
                  <el-col :xl="24" :lg="24">
                    <el-input type="textarea" :rows="2" placeholder="在上方字段中输入检索词，在此处预览您的检索式" v-model="exp">
                    </el-input>
                  </el-col>
                </el-col>
                <el-col :span="24" style="margin-bottom: 20px">
                  <el-col :xl="5" :lg="12">
                    <el-button @click="emty" style="width: 100px; background-color: #909cb2; color: #fff">清空</el-button>
                    <el-button @click="Clickexpers" style="width: 100px; background-color: #45a321; color: #fff">搜索
                    </el-button>
                  </el-col>
                </el-col>
              </el-row>
            </div>
          </el-main>
        </div>

        <div v-else>
          <el-container>
            <el-aside width="265px">
              <!-- <el-aside width="0"> -->
              <div class="rightMenu" v-loading="menuType" element-loading-text="拼命加载中">
                <div v-if="checkList.length > 0" class="click_flex">
                  <span style="font-weight: 600">已选</span>
                  <span @click="emtySenior" class="pubBtn" style="
                    border-radius: 5px;
                    padding: 5px;
                    cursor: pointer;
                    font-size: 14px;
                  ">清除选中</span>
                </div>
                <div v-if="checkList.length > 0">
                  <div v-for="(item, index) in checkList" :key="item.id" class="checkedList_box">
                    <p class="checkedList">{{ item.title }}-{{ item.value }}</p>
                    <i @click="remove(item)" class="el-icon-close"></i>
                  </div>
                </div>

                <div style="
                  padding: 10px 15px;
                  border-bottom: 1px solid #d3dbeb;
                  font-weight: 600;
                  width: 265px;
                ">
                  筛选项
                </div>
                <el-menu :default-active="activeIndex" @open="handleOpen" v-if="menu.length" :unique-opened="true" class="el-menu-vertical-demo">
                  <el-submenu  v-for="(item, index) in menu" :index="index.toString()" :popper-append-to-body="true"
                    :key="index">
                    <template slot="title">
                      <span>{{ item.title }}</span>
                    </template>
                    <el-menu-item-group>
                      <el-menu-item  v-for="(i, c) in item.list" :index="index.toString()" :key="c">
                        <el-checkbox v-model="i.checked" @change="clickget(i, $event, index, c)">
                          <span class="set_span">{{ i.value }}</span>
                          <span class="screen_item_span">{{ i.count }}</span>
                        </el-checkbox>
                      </el-menu-item>
                    </el-menu-item-group>
                  </el-submenu>
                </el-menu>
                <div v-else>暂无数据</div>
              </div>
            </el-aside>
            <el-main class="ListBox">
              <slot></slot>
              <div class="menu">
                <div style="flex: 1; background-color: rgb(244, 245, 247)">
                  <div class="tableDataBox">
                    <div class="searchBox">
                      <div class="total">
                        <el-button type="primary" size="mini" @click="Deleteres"
                          icon="el-icon-arrow-left">返回检索</el-button>
                        <div class="Subhead">
                          共{{ total }}条专利信息
                          <span style="max-width: 480px;">
                            检索式：
                            {{ this.exp + this.clickgetExp }}
                          </span>
                        </div>
                      </div>

                      <div class="center">
                        <div>
                          <div class="newInput" style="display: flex; align-items: center">
                            <el-input clearable type="text" v-model="Keyinput" placeholder="在列表中搜索"
                              class="input-with-select">
                              <!-- <el-button slot="append" @click="search">检索</el-button>
                        <i slot="prefix-icon" class="el-icon-search"></i> -->
                            </el-input>
                          </div>
                        </div>

                        <div>
                          <el-select v-model="sort_column" placeholder="请选择排序类型">
                            <el-option v-for="item in columnOptions" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </div>

                        <div>
                          <el-select v-model="sort_column2" placeholder="请选择排序顺序">
                            <el-option v-for="item in columnOptions2" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </div>

                        <div>
                          <el-select v-model="sort_column3" placeholder="请选择是否精准搜索">
                            <el-option v-for="item in columnOptions3" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </div>

                        <div>
                          <el-button type="primary" @click="search">检索</el-button>
                        </div>
                      </div>

                      <div>
                        <div class="vs_iconfont">
                          <el-tooltip class="item" effect="dark" content="预览" placement="bottom">
                            <i class="iconfont icon-yulan" :class="is_show == 2 ? 'vs_action' : ''"
                              @click="is_show = 2"></i>
                          </el-tooltip>
                          <el-tooltip class="item" effect="dark" content="视图" placement="bottom">
                            <i class="iconfont icon-shitu" :class="is_show == 1 ? 'vs_action' : ''"
                              @click="is_show = 1"></i>
                          </el-tooltip>
                        </div>
                      </div>
                    </div>

                    <div v-if="is_show == 1">
                      <div class="" v-if="patent_list.length">
                        <el-table @row-click="rowClick" :data="patent_list" border height="600"
                          :header-cell-style="{ background: '#F3F8FE' }">
                          <el-table-column prop="tic" align="center" label="专利标题" width="180">
                            <template slot-scope="scope">
                              {{ scope.row.tio }}
                              <el-tag style="border: none" size="small" effect="dark" color="#4ba22f"
                                v-if="scope.row.lsscn == '有效'">{{ scope.row.lsscn }}
                              </el-tag>

                              <el-tag style="border: none" size="small" effect="dark" color="#6c778b"
                                v-if="scope.row.lsscn == '无权'">{{ scope.row.lsscn }}
                              </el-tag>
                            </template>
                          </el-table-column>
                          <el-table-column prop="pns" align="center" label="公开(公告)号" width="180">
                          </el-table-column>
                          <el-table-column prop="pdt" align="center" label="专利类型">
                          </el-table-column>
                          <el-table-column prop="ino" align="center" label="发明人">
                          </el-table-column>
                          <el-table-column prop="ad" align="center" label="申请日">
                            <template slot-scope="scope">
                              <span v-if="scope.row.ad">{{ scope.row.ad | formatDate }}</span>
                            </template>
                          </el-table-column>
                          <el-table-column prop="pd" align="center" label="公告(公开)日">
                            <template slot-scope="scope">
                              <span v-if="scope.row.pd">{{ scope.row.pd | formatDate }}</span>
                            </template>
                          </el-table-column>
                          <el-table-column prop="ano" align="center" label="申请号">
                          </el-table-column>
                          <el-table-column prop="aso" align="center" label="专利权人">
                            <template slot-scope="scope">
                              <span v-if="scope.row.aso">{{ scope.row.aso }}</span>
                            </template>
                          </el-table-column>
                          <!-- <el-table-column prop="pns" align="center" label="公布号">
                          </el-table-column> -->
                          <el-table-column prop="cri" align="center" label="代理机构">
                          </el-table-column>
                        </el-table>
                      </div>
                    </div>

                    <div v-if="is_show == 2">
                      <el-row>
                        <el-col class="hovers" v-for="(item, index) in patent_list" :key="index">
                          <div @click="clickDetails(item)">
                            <p>
                              <span class="cril"></span>
                              #{{ index + 1 }}
                            </p>
                            <div class="patent_info">
                              <div class="info_img">
                                <el-image style="width: 140px; height: 208px; margin-top: 10px" :src="item.IMGO"
                                  fit="contain"></el-image>
                              </div>
                              <div class="info_text">
                                <div class="info_text_div">
                                  <span class="sz">
                                    {{ item.tio }}
                                    <el-tag style="border: none" size="small" effect="dark" color="#4ba22f"
                                      v-if="item.lsscn == '有效'">{{ item.lsscn }}
                                    </el-tag>

                                    <el-tag style="border: none" size="small" effect="dark" color="#6c778b"
                                      v-if="item.lsscn == '无权'">{{ item.lsscn }}
                                    </el-tag>
                                  </span>
                                </div>

                                <div class="info_text_divBox">
                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      专利类型：{{ item.pdt }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      发明人：{{ item.ino }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      申请日：{{ item.ad }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      公告(公开)日：{{ item.pd }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      申请号：{{ item.ano }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      公开(公告)号：{{ item.pns }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      公布号：{{ item.pns }}
                                    </p>
                                  </div>

                                  <div class="info_text_div">
                                    <p class="context" style="margin-bottom: 10px">
                                      代理机构：{{ item.cri }}
                                    </p>
                                  </div>
                                </div>

                                <div class="info_text_div">
                                  <p class="context zy_color">摘要</p>
                                  <p class="context w">
                                    {{ item.abso }}
                                  </p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </el-col>
                      </el-row>
                    </div>

                    <div class="pagination" style="width: 90%; margin: 40px auto">
                      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                        :current-page="page" :page-size="page_row" layout=" prev, pager, next, jumper"
                        :total="Number(parseInt(total))" align="left"></el-pagination>
                    </div>
                  </div>
                </div>
              </div>
            </el-main>
          </el-container>
        </div>
      </div>
      <div v-else>
        <el-main class="left">
          <div class="boxWidth">
            <div class="title">
              <div>{{ seniortype ? "高级检索" : "普通检索" }}</div>
              <div>
                <el-button style="
                  display: block;
                  background-color: #106bf3;
                  border-color: #33bf92;
                  border-radius: 10px;
                " @click="SearchType" type="primary">切换至{{ seniorName }}</el-button>
              </div>
            </div>

            <div>
              <el-input v-model="inputVal" @keyup.enter.native="searchIntelligences" placeholder="可输入关键词进行检索"
                autocomplete="on" class="input-with-select">
                <template #prepend>
                  <div class="selectBoxNew">专利检索</div>
                </template>
                <template #append>
                  <el-button icon="el-icon-search" @click="searchIntelligences" />
                </template>
              </el-input>
            </div>
          </div>
        </el-main>
      </div>
    </div>
    <div v-else-if="radio == '商标'">
      <el-main class="left">
        <div class="boxWidth">
          <div class="title">
            <div>商标检索</div>
          </div>
          <div style="margin-bottom: 20px">
            <el-input v-model="trademarkVal" @keyup.enter.native="searchTrademark" placeholder="可输入关键词进行检索"
              autocomplete="on" class="input-with-select">
              <template #prepend>
                <el-select v-model="trademarkType" placeholder="请选择">
                  <el-option v-for="item in trademarkTypeList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </template>
              <template #append>
                <el-button icon="el-icon-search" @click="searchTrademark" />
              </template>
            </el-input>
          </div>
        </div>
      </el-main>
    </div>
    <div v-else-if="radio == '诉讼'">
      <el-main class="left">
        <div class="boxWidth">
          <div class="title">
            <div>诉讼检索</div>
          </div>
        </div>
      </el-main>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import { expression } from "@/api/user";
import { fields, getExpression, statistics } from "@/api/configApi";
import { expressionDi, statisticsDi } from "@/api/newuser";
export default {
  components: {
  },
  data() {
    return {
      radio: '专利',
      Keyinput: "",
      menuType: false,
      is_show: 1,
      page_row: 10,
      categoryColumn: [
        "PDT",
        "LSBCN",
        "LSBFO",
        'IPC',
        "AY",
        "PY",
        "ASO",
        'INO',
        'EPRY',
        'CPC',
        'LC',
        "APO",
        'APCL',
        'ASCL',
        'CRO',
        'AGO',
        'EXO',
        'FTKO',
        'AC',
        'AP1A',
        'APPPC',
        'SFCL',
        'PCT',
        'DP',
        'PRES',
        'PINS',
        'PLI',
        'TS',
        'LS',
        'PS',
        'EPRNO'
      ],
      categoryColumnObject: {
        PDT: "专利类型",
        LSBCN: "中国当前权利状态",
        LSBFO: "国外当前权利状态",
        IPC: "IPC",
        AY: "申请年",
        PY: "公布年",
        ASO: "专利权人",
        INO: "发明人",
        EPRY: "最早优先权年",
        CPC: "CPC",
        LC: "洛迦诺",
        APO: "申请人",
        APCL: "申请人类型",
        ASCL: "专利权人类型",
        CRO: "代理机构",
        AGO: "代理人",
        EXO: "审查员",
        FTKO: "关键词",
        AC: "受理国",
        AP1A: "来源国",
        APPPC: "中国省份",
        SFCL: "同族国别",
        PCT: "PCT专利",
        DP: "分案申请",
        PRES: "复审决定",
        PINS: "无效专利",
        PLI: "法院判决",
        TS: "专利转让",
        LS: "专利许可",
        PS: "专利质押",
        EPRNO: "最早优先权",
      },
      activeIndex: "0",
      menu: [{
        key: "PDT",
        title: "专利类型",
        count: 0,
        list: []
      },
      {
        key: "LSBCN",
        title: "中国当前权利状态",
        list: []
      },
      {
        key: "LSBFO",
        title: "国外当前权利状态",
        list: []
      },
      {
        key: "IPC",
        title: "IPC",
        list: []
      },
      {
        key: "AY",
        title: "申请年",
        list: []
      },
      {
        key: "PY",
        title: "公布年",
        list: []
      },
      {
        key: "ASO",
        title: "专利权人",
        list: []
      },
      {
        key: "INO",
        title: "发明人",
        list: []
      },
      {
        key: "EPRY",
        title: "最早优先权年",
        list: []
      },
      {
        key: "CPC",
        title: "CPC",
        list: []
      },
      {
        key: "LC",
        title: "洛迦诺",
        list: []
      },
      {
        key: "APO",
        title: "申请人",
        list: []
      },
      {
        key: "APCL",
        title: "申请人类型",
        list: []
      },
      {
        key: "ASCL",
        title: "专利权人类型",
        list: []
      },
      {
        key: "CRO",
        title: "代理机构",
        list: []
      },
      {
        key: "AGO",
        title: "代理人",
        list: []
      },
      {
        key: "EXO",
        title: "审查员",
        list: []
      },
      {
        key: "FTKO",
        title: "关键词",
        list: []
      },
      {
        key: "AC",
        title: "受理国",
        list: []
      },{
        key: "AP1A",
        title: "来源国",
        list: []
      },
      {
        key: "APPPC",
        title: "中国省份",
        list: []
      },
      {
        key: "SFCL",
        title: "同族国别",
        list: []
      },
      {
        key: "PCT",
        title: "PCT专利",
        list: []
      },
      {
        key: "DP",
        title: "分案申请",
        list: []
      },
      {
        key: "PRES",
        title: "复审决定",
        list: []
      },
      {
        key: "PINS",
        title: "无效专利",
        list: []
      },
      {
        key: "PLI",
        title: "法院判决",
        list: []
      },
      {
        key: "TS",
        title: "专利转让",
        list: []
      },
      {
        key: "LS",
        title: "专利许可",
        list: []
      },
      {
        key: "PS",
        title: "专利质押",
        list: []
      },
      {
        key: "EPRNO",
        title: "最早优先权",
        list: []
      },

      ],
      inputVal: "",
      seniorName: "高级检索",
      seniortype: false,
      data: [],
      num: 3,
      exactSearch: 1,
      leng: [
        {
          name: "AND",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
      ],
      lssc: "",
      lsscOptions: [
        { value: "1", label: "有效" },
        { value: "2", label: "无效" },
        { value: "3", label: "在审" },
        { value: "8", label: "不影响" },
        { value: "9", label: "不确定/待定" },
      ],
      pdt: "",
      pdtOptions: [
        { value: "发明", label: "发明" },
        { value: "实用新型", label: "实用新型" },
        { value: "外观设计", label: "外观设计" },
      ],
      columnOptions: [
        { value: "AD", label: "申请日" },
        { value: "PD", label: "公布日" },
        { value: "EPRD", label: "最早优先权日" },
        { value: "SFC", label: "简单同族数量" },
        { value: "CIPC", label: "引证数量" },
        { value: "VU", label: "专利强度" },
        { value: "CIGC", label: "被引证数量" },
        { value: "INCO", label: "发明人数量" },
        { value: "IPCSGC", label: "IPC小类数量" },
        { value: "CLN", label: "权利要求数量" },
        { value: "DEPC", label: "说明书页数" },
        { value: "DC", label: "附图页数" },
        { value: "TCC", label: "转让次数" },
        { value: "PCC", label: "许可次数" },
        { value: "PPC", label: "质押次数" },
      ],
      columnOptions2: [
        { value: "+", label: "升序" },
        { value: "-", label: "降序" },
      ],
      columnOptions3: [
        { value: "1", label: "精准检索" },
        { value: "0", label: "模糊检索" },
      ],
      trademarkVal: '',
      trademarkType: '全部',
      trademarkTypeList: [{
        value: '全部',
        label: '全部'
      }, {
        value: '申请人名称',
        label: '申请人名称'
      }, {
        value: '商标名称',
        label: '商标名称'
      }, {
        value: '注册号',
        label: '注册号'
      }],
      input: "",
      textarea: "",
      check: "",
      sort_column: "AD",
      sort_column2: "-",
      sort_column3: "1",
      exp: sessionStorage.getItem("exp") ? sessionStorage.getItem("exp") : "",
      // exp:  "",
      seniorListType: false,
      patent_list: [],
      patent_list2: [],
      list: [],

      clickgetTrue: {}, //存储左侧选中的对象值
      clickgetExp: "", //左侧动态添加的检索词
      checkList: [], //左上侧筛选框

      page: sessionStorage.getItem("list_page")
        ? Number(sessionStorage.getItem("list_page"))
        : 1,

      total: '',
    };
  },
  // 过滤器
  filters: {
    //时间2024/12/19 00:00:00 变成 2024/12/19
    formatDate(date) {
      if (!date) {
        return "";
      }
      return date.split(" ")[0];
    },
  },
  computed: {
    ...mapGetters(["sidebar"]),
    isCollapse() {
      return !this.sidebar.opened;
    },
  },
  async mounted() {
    try {
      this.data = await fields();//高级检索条件列表
      if (this.exp !== "") {
        this.handleCurrentChange(this.page);
        this.statisticsDi();
      }
      this.leng = sessionStorage.getItem("leng")
        ? JSON.parse(sessionStorage.getItem("leng"))
        : this.leng;
    } catch (e) {
      this.$message.error(e.message);
    }
  },
  methods: {
    clickget(i, e, index, childIndex) {
      if (!this.clickgetTrue[this.menu[index].key]) {
        this.clickgetTrue[this.menu[index].key] = [];
      }
      console.log(this.menu[index].list[childIndex],'this.menu[index].list[childIndex]')
      if (this.menu[index].list[childIndex].checked) {
        this.clickgetTrue[this.menu[index].key].push(this.menu[index].list[childIndex]);
        let obj = this.menu[index].list[childIndex]
        obj.title = this.menu[index].title
        this.checkList.push(obj);
      } else {
        this.clickgetTrue[this.menu[index].key] = this.clickgetTrue[
          this.menu[index].key
        ].filter((item) => item.value != this.menu[index].list[childIndex].value);
        this.checkList = this.checkList.filter(
          (item) => item.value != this.menu[index].list[childIndex].value
        );
      }

      this.clickgetExp = "";

      for (let item in this.clickgetTrue) {
        this.clickgetTrue[item].map((res) => {
          this.clickgetExp =
            this.clickgetExp +
            " AND " +
            this.categoryColumnObject[item] +
            "=" +
            res.value;
        });
      }

      console.log('点击');
      //刷新列表
      this.page = 1;
      this.handleCurrentChange(this.page);
      this.statisticsDi(this.categoryColumnObject[this.categoryColumn[this.activeIndex]],this.activeIndex);
    },
    search() {
      console.log(this.Keyinput, "Keyinput");
      if (this.Keyinput) {
        this.exp =
          this.exp + " AND 名称+摘要和说明+权利要求书+说明书全文=" + this.Keyinput;
      }
      this.page = 1;
      this.handleCurrentChange(this.page);
      this.statisticsDi(this.categoryColumnObject[this.categoryColumn[this.activeIndex]],this.activeIndex);
    },
    clickDetails(item) {
      this.$emit("clickDetails", item);
    },
    searchIntelligences() {
      this.$emit("searchIntelligences", this.inputVal);
    },
    searchTrademark() {
      this.$emit("searchTrademark", this.trademarkVal, this.trademarkType);
    },
    SearchType() {
      this.seniortype = !this.seniortype;
      if (this.seniortype) {
        this.seniorName = "普通检索";
      } else {
        this.seniorName = "高级检索";
      }
    },
    emty() {
      this.exp = "";
      this.lssc = "";
      this.pdt = "";
      this.sort_column = "";
      this.leng = [
        {
          name: "AND",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
        {
          name: "",
          select: "",
          input: "",
        },
      ];
    },
    async changs(val) {
      try {
        const res = await getExpression({ field: this.leng });
        this.exp = res.text;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async changs2(val) {
      try {
        const res = await getExpression({ field: this.leng });
        this.exp = res.text;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async changs3(val) {
      try {
        const res = await getExpression({ field: this.leng });
        this.exp = res.text;
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async changInpnut(index) {
      try {
        if (this.leng[index].select) {
          const res = await getExpression({ field: this.leng });
          this.exp = res.text;
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    async changInpnut2(index) {
      try {
        if (this.leng[index + 1]) {
          const res = await getExpression({ field: this.leng });
          this.exp = res.text;
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    addNum() {
      this.num++;
    },
    Deleteres() {
      this.patent_list = "";
      this.list = "";
      this.seniorListType = ''
      this.menu = [{
        key: "PDT",
        title: "专利类型",
        count: 0,
        list: []
      },
      {
        key: "LSBCN",
        title: "中国当前权利状态",
        list: []
      },
      {
        key: "LSBFO",
        title: "国外当前权利状态",
        list: []
      },
      {
        key: "IPC",
        title: "IPC",
        list: []
      },
      {
        key: "AY",
        title: "申请年",
        list: []
      },
      {
        key: "PY",
        title: "公布年",
        list: []
      },
      {
        key: "ASO",
        title: "专利权人",
        list: []
      },
      {
        key: "INO",
        title: "发明人",
        list: []
      },
      {
        key: "EPRY",
        title: "最早优先权年",
        list: []
      },
      {
        key: "CPC",
        title: "CPC",
        list: []
      },
      {
        key: "LC",
        title: "洛迦诺",
        list: []
      },
      {
        key: "APO",
        title: "申请人",
        list: []
      },
      {
        key: "APCL",
        title: "申请人类型",
        list: []
      },
      {
        key: "ASCL",
        title: "专利权人类型",
        list: []
      },
      {
        key: "CRO",
        title: "代理机构",
        list: []
      },
      {
        key: "AGO",
        title: "代理人",
        list: []
      },
      {
        key: "EXO",
        title: "审查员",
        list: []
      },
      {
        key: "FTKO",
        title: "关键词",
        list: []
      },
      {
        key: "AC",
        title: "受理国",
        list: []
      },{
        key: "AP1A",
        title: "来源国",
        list: []
      },
      {
        key: "APPPC",
        title: "中国省份",
        list: []
      },
      {
        key: "SFCL",
        title: "同族国别",
        list: []
      },
      {
        key: "PCT",
        title: "PCT专利",
        list: []
      },
      {
        key: "DP",
        title: "分案申请",
        list: []
      },
      {
        key: "PRES",
        title: "复审决定",
        list: []
      },
      {
        key: "PINS",
        title: "无效专利",
        list: []
      },
      {
        key: "PLI",
        title: "法院判决",
        list: []
      },
      {
        key: "TS",
        title: "专利转让",
        list: []
      },
      {
        key: "LS",
        title: "专利许可",
        list: []
      },
      {
        key: "PS",
        title: "专利质押",
        list: []
      },
      {
        key: "EPRNO",
        title: "最早优先权",
        list: []
      },

      ]
      this.checkList = [];
      this.clickgetTrue = {};
      this.clickgetExp = "";
    },
    //大写转小写
    convertToLowercase(str) {
      return str.toUpperCase().toLowerCase();
    },
    //小写转大写
    toUpperCase(str) {
      return str.toUpperCase();
    },
    handleOpen(key){
      this.activeIndex = key;
      console.log(this.activeIndex,'activeIndex');
      console.log(key,'key');
      console.log(this.categoryColumn[key],'this.categoryColumn[key]');
      console.log(this.categoryColumnObject[this.categoryColumn[key]],'this.categoryColumnObject[this.categoryColumn[key]]');
      this.statisticsDi(this.categoryColumnObject[this.categoryColumn[key]],key)
    },
    async statisticsDi(categoryColumn,index) {
      // if(!categoryColumn ){
      //   return;
      // }
      if(!categoryColumn ){
        return;
      }
      
      // this.menu = [];
      this.menuType = true;
      const resA = await statistics({
        express: this.exp + this.clickgetExp,
        exactSearch: this.exactSearch,
        // categoryColumn: this.categoryColumn.join(";"),
        categoryColumn: categoryColumn
      });
      console.log(resA,'');
      this.menuType = false;
      if(resA == ""){
        this.menu[index].list = []
        this.$message.error('暂无筛选数据');
      }




      for (let key in resA.list) {
        // let obj = {
        //   title: "",
        //   list: [],
        //   key: "",
        // };
        // obj.title = this.categoryColumnObject[this.toUpperCase(key)];
        // obj.key = this.toUpperCase(key);

        let list = resA.list[key].map((res, index_) => {
          res.checked = false;
          console.log(this.clickgetTrue,'66adasd',key);
          console.log(this.toUpperCase(key))

          // this.clickgetTrue[this.toUpperCase(key)]
          //   ? this.clickgetTrue[this.toUpperCase(key)].map((res_) => {
          //     console.log(res.value,'adasd');
          //     console.log(res_.value,'adsasd');
          //     if (res.value == res_.value) {
          //       res.checked = true;
          //     }
          //   })
          //   : "";

          // 遍历对象this.categoryColumnObject
          for (let key_ in this.categoryColumnObject) {
            // 如果对象的属性值等于key
            if (this.categoryColumnObject[key_] == key) {
              this.clickgetTrue[key_] ? this.clickgetTrue[key_].map((res_) => {
              console.log(res.value,'adasd');
              console.log(res_.value,'adsasd');
              if (res.value == res_.value) {
                res.checked = true;
              }
            }): ""
            } 
          }
          return res;
        });

        // obj.list = list;
        // console.log(obj);
        // this.menu.push(obj);
        this.menu[index].list = []
        this.menu[index].list.push(...list)

        if(categoryColumn == '申请年' || categoryColumn == '公布年' || categoryColumn == '最早优先权年'){
          //this.menu[index].list中的value取前四位
          this.menu[index].list.map((res) => {
            res.value = res.value.slice(0, 4); 
          })
        }

        console.log(this.menu[index]);
      }



    },
    async Clickexpers() {
      try {
        // exp
        if (this.exp) {
          const res = await expressionDi({
            express: this.exp + this.clickgetExp,
            exactSearch: this.exactSearch,
            categoryColumn: this.categoryColumn.join(";"),
          });
          if (res == "") {
            throw new Error("暂无数据");
          } else {
            this.statisticsDi(this.categoryColumnObject[this.categoryColumn[this.activeIndex]],this.activeIndex);
            this.seniorListType = true
            this.patent_list = res.list;
            this.list = res.page;
            this.page = res.page;
            this.page_row = res.page_row
            this.total = Number(res.total)
            if (this.total >= 10000) {
              this.total = 10000;
            }
          }
        } else {
          throw new Error("请填写检索词");
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    rowClick(row) {
      this.$emit("rowClick", row);
      sessionStorage.setItem("pc", 1);
      sessionStorage.setItem("Shundepc", 1);
      sessionStorage.setItem("leng", JSON.stringify(this.leng));
      sessionStorage.setItem("exp", this.exp);
      sessionStorage.setItem("list_page", this.page);
    },
    //每页下拉显示数据
    async handleSizeChange(size) {
      try {
        const res = await expressionDi({
          page: size,
          express: this.exp + this.clickgetExp,
          exactSearch: this.exactSearch,
          sort_column: this.sort_column,
        });
        if (res == "") {
          throw new Error("暂无数据");
        } else {
          this.patent_list = res.list;
          this.list = res.page;
          this.page = res.page;
          this.page_row = res.page_row
          this.total = Number(res.total)

          if (this.total >= 10000) {
            this.total = 10000;
          }
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },
    //点击第几页
    async handleCurrentChange(currentPage) {
      try {
        const res = await expressionDi({
          page: currentPage,
          express: this.exp + this.clickgetExp,
          exactSearch: this.exactSearch,
          sort_column: this.sort_column,
        });
        this.Keyinput = "";

        if (res == "") {
          this.patent_list = [];
          this.list = {
            page: 1,
            page_row: 10,
            total: "0",
          };
          this.total = 0
          this.page_row = 10
          this.page = 1;
          this.clickgetExp = "";
          throw new Error("暂无数据");
        } else {
          this.patent_list = res.list;
          this.list = res.page;
          this.page = currentPage;
          this.total = Number(res.total)

          if (this.total >= 10000) {
            this.total = 10000;
          }
        }
      } catch (e) {
        this.$message.error(e.message);
      }
    },

    remove(item) {
      this.checkList.splice(this.checkList.indexOf(item), 1);
      for (let item_ in this.clickgetTrue) {
        this.clickgetTrue[item_].map((res, index) => {
          if (item.value == this.clickgetTrue[item_][index].value) {
            this.clickgetTrue[item_].splice(index, 1);

            this.menu.map((res_1, index_1) => {
              if (res_1.key == item_) {
                this.menu[index_1].list.map((res_2, index_2) => {
                  if (res_2.value == item.value) {
                    this.menu[index_1].list[index_2].checked = false;
                  }
                });
              }
            });
          }
        });
      }

      this.clickgetExp = "";

      for (let item in this.clickgetTrue) {
        this.clickgetTrue[item].map((res) => {
          this.clickgetExp =
            this.clickgetExp +
            " AND " +
            this.categoryColumnObject[item] +
            "=" +
            res.value;
        });
      }

      // //刷新列表
      this.page = 1;
      this.handleCurrentChange(this.page);
      this.statisticsDi(this.categoryColumnObject[this.categoryColumn[this.activeIndex]],this.activeIndex);
    },

    emtySenior() {
      this.checkList = [];
      this.clickgetTrue = {};

      // //刷新列表

      this.clickgetExp = "";

      for (let item in this.clickgetTrue) {
        this.clickgetTrue[item].map((res) => {
          this.clickgetExp =
            this.clickgetExp +
            " AND " +
            this.categoryColumnObject[item] +
            "=" +
            res.value;
        });
      }

      this.page = 1;
      this.handleCurrentChange(this.page);
      this.statisticsDi(this.categoryColumnObject[this.categoryColumn[this.activeIndex]],this.activeIndex);
    },
  },
};
</script>

<style scoped lang="less">
::v-deep .el-submenu {
  border-bottom: 1px solid #d3dbeb;

  .el-menu-item {
    padding: 0 20px !important;
    height: 40px;
    line-height: 40px;
  }
}

::v-deep .el-menu-item-group__title {
  padding: 0;
}

::v-deep .el-submenu__title {
  height: 40px;
  line-height: 40px;
}

::v-deep .el-input-group {
  height: 74px;
  box-shadow: 0px 11px 35px 0px rgba(216, 222, 232, 0.38);
  border: 1px solid #dcdfe6;

  .el-input-group__prepend {
    background-color: #f5f7fa;
    border: 1px solid #dcdfe6 !important;
    font-size: 24px;
    color: #909399 !important;
  }


  .el-input__inner {
    font-size: 18px;
    height: 74px;
    border: 0px solid #dcdfe6;
    font-family: alibabapuhuitiRegular;
  }

  .el-input-group__append {
    background-color: #fff;
    border: 0px solid #dcdfe6;
    padding: 0;

    .el-button {
      background-color: #0f75b8;
      color: #fff;
      height: 54px;
      width: 102px;
      margin: 0 11px;
      font-size: 33px;
    }
  }
}

::v-deep .newInput .el-input-group {
  height: 40px;
  box-shadow: 0px 11px 35px 0px rgba(216, 222, 232, 0);
  border: 1px solid #dcdfe6;

  .el-input-group__prepend {
    background-color: #f5f7fa;
    border: 1px solid #dcdfe6 !important;
    font-size: 24px;
    color: #909399 !important;
  }

  .el-input__wrapper {}

  .el-input__inner {
    font-size: 16px;
    height: 40px;
    border: 0px solid #dcdfe6;

    font-family: alibabapuhuitiRegular;
  }

  .el-input-group__append {
    background-color: #fff;
    border: 0px solid #dcdfe6;
    padding: 0;

    .el-button {
      background-color: #0f75b8;
      color: #fff;
      height: 32px;
      width: 58px;
      margin: 0 3px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 16px;
    }
  }
}

.radioDom {
  width: 1200px;
  margin-top: 20px;
}

.tableDataBox {
  background-color: #fff;
  margin: 20px 20px 0 20px;
  padding: 20px;

  .searchBox {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;

    .total {
      display: flex;
      justify-content: space-around;
      align-items: center;

      .Subhead {
        color: #2a8b2d;
        margin-left: 10px;
        display: flex;
        flex-direction: column;
      }
    }

    .center {
      display: flex;
      justify-content: space-around;
      // margin: 0 10%;
      width: 60%;
    }
  }
}

.hovers {
  padding: 20px 0 0 20px;
  cursor: pointer;

  .patent_info {
    display: flex;
    margin: 10px 0;

    .info_img {
      width: 188px;
      height: 237px;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(230, 233, 240, 1);
      border-radius: 5px;
      text-align: center;
      margin-right: 20px;
    }

    .info_text {
      flex: 1;

      .info_text_div {
        margin-bottom: 19px;
      }

      .info_text_divBox {
        .info_text_div {
          margin-bottom: 19px;

          .zy_color {
            color: #37f;
            margin-bottom: 13px;
          }
        }
      }
    }
  }
}

.hovers:hover {
  background-color: #f4f5f7;
}

.menu {
  // display: flex;
  // height: 105vh;
  // overflow: scroll;
  // overflow-x: hidden;
  // overflow-y: auto;
}

.screen_item_span {
  margin-left: 10px;
}

::v-deep .checkbox__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

::v-deep .el-checkbox {
  width: 100%;
  display: flex;
  align-items: center;

  .el-checkbox__label {
    width: 100%;
    display: flex;
    padding-right: 10px;
    justify-content: space-between;
    align-items: center;
  }
}

.set_span {
  max-width: 123px;
  height: 40px;
  line-height: 40px;
  display: inline-block;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.boxWidth {
  width: 1200px;
  min-height: 800px;
}

.title {
  font-size: 75px;
  font-family: Alibaba PuHuiTi;
  font-weight: bold;
  color: #202225;
  margin: 48px 0;
  display: flex;
  justify-content: space-between;
}

.left {
  // padding-left: 400px;
  display: flex;
  justify-content: center;
}

.el-main {
  margin: 0;
  padding: 0;
}

.rightMenu {
  width: 265px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 60px;
  background-color: #fff;

  .click_flex {
    display: flex;
    margin: 10px 25px;
    justify-content: space-between;
    align-items: center;
  }

  .checkedList_box {
    background-color: #f7f9fc;
    border: 1px solid #dcdfe6;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 0 10px 10px;
    padding: 0 5px;

    .checkedList {
      width: 100%;
      margin: 5px 0;
      // padding: 10px 0;
      // border-bottom:1px solid #3377ff;
      word-break: break-word;
      font-size: 12px;
      // color:#3377ff ;
    }
  }
}

.ListBox {
  background-color: #f4f5f7;
}

.navbar {
  width: 100%;
  box-shadow: none;
}

.sidebar-logo-container {
  width: 20%;
}

// .el-col-24 {
//   margin-bottom: 20px;
// }

@media (max-width: 1360px) {}

@media (max-width: 750px) {
  .v_span2 {
    display: block;
  }

  .mb_zy {
    margin-bottom: 10px !important;
  }

  .NavItem,
  .Header,
  .main-top {
    width: 100%;
    margin-left: 0 !important;
    padding-bottom: 0;
    top: 0;
  }

  .pc {
    display: none;
  }

  .mb {
    display: block;
  }

  .detail_info_title {
    margin: 15px 0;
  }

  .detail_info_last {
    margin: 15px 0;
  }

  .infos {
    margin: 10px 0 0 0;
  }

  .detail_info {
    margin-bottom: 30px;
    flex-wrap: wrap;
    flex-direction: column-reverse;
    width: 100%;
  }

  .detail_info_first_box {
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
  }

  .detail_head_title {
    width: auto;
  }

  .img-box {
    width: 100%;
  }

  .abst__layout-row {
    flex-direction: column;
  }

  .mb_top {
    margin-top: 20px;
  }

  .mb_context {
    font-weight: bold;
    margin-bottom: 10px;
    width: 100% !important;
  }

  .v_span2 {
    padding-left: 0;
  }

  .tio {
    line-height: 1.3;
  }

  .icon-tog {
    text-align: center;
    display: inline-block;
    line-height: 46px;
  }

  .icon-toggle {
    font-size: 25px !important;
  }

  .title_pns {
    border-bottom: 1px solid #c8d0dc;
    padding-bottom: 10px;
  }

  .transition-box {
    position: fixed;
    right: 0;
    width: 100%;
    height: 100%;
    top: 0;
    z-index: 9;
    background-color: rgba(0, 0, 0, 0.3);
  }

  .el-zoom-in-top {
    position: fixed;
    width: 80%;
    height: 100%;
    margin: 0 auto;
    background-color: #fff;
    top: 0;
    right: 0;
    z-index: 10;
  }

  .mb_nav_li {
    margin: 30px auto;
  }

  .mb_nav_li li {
    margin-top: 20px;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
  }

  .close {
    float: right;
    padding: 10px;

    .iconfont {
      font-size: 25px;
    }
  }
}
</style>
